//
//  LzwBeauTableCell.m
//  HalfsugarAPP
//
//  Created by 刘志武 on 15/12/31.
//  Copyright © 2015年 刘志武. All rights reserved.
//

#import "LzwBeauTableCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"


@interface LzwBeauTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myIamgeBeatiful;
@property (nonatomic, retain) LzwBaseImageView *myIamgeBeatiful1;

@property (nonatomic, retain) LzwBaseLable *myLableBeautiful;
@property (nonatomic, retain) LzwBaseLable *myLableBeautiful1;


@end

@implementation LzwBeauTableCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatBeauView];
    }
    return self;
}

- (void)creatBeauView{
    
    //图片
    self.myIamgeBeatiful = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(2 * WIDTH, 2 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myIamgeBeatiful.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myIamgeBeatiful];
    
    //喜爱图片
    self.myIamgeBeatiful1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myIamgeBeatiful1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myIamgeBeatiful1];
    
    //描述
    self.myLableBeautiful = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableBeautiful.textColor = [UIColor lightGrayColor];
    self.myLableBeautiful.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableBeautiful.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableBeautiful];
    
    //喜爱人数
    self.myLableBeautiful1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableBeautiful1.textColor = [UIColor lightGrayColor];
    self.myLableBeautiful1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableBeautiful1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableBeautiful1];

    
}

-(void)setModleBeautiful:(LzwBeautifulModle *)modleBeautiful{
    
    if (_modleBeautiful != modleBeautiful) {
        [_modleBeautiful release];
        _modleBeautiful = [modleBeautiful retain];
    }
    
    self.myLableBeautiful.text = self.modleBeautiful.title;
    self.myLableBeautiful1.text = self.modleBeautiful.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleBeautiful.pic];
    
    [self.myIamgeBeatiful sd_setImageWithURL:url placeholderImage:nil];
    
}

@end
